#
# Build our custom version of the Build Menu
#
Set Exit 0
	DeleteMenu Build ³ Dev:Null
	AddMenu Build 'Create Build CommandsÉ' ¶
		'Set Program "`¶`Commando CreateMake || Echo Set Status 0¶` ³ "{ShellDirectory}"MPW.Errors ¶
			|| Alert < "{ShellDirectory}"MPW.Errors`"'
	AddMenu Build '(-' ''
	AddMenu Build 'BuildÉ/B' ¶
		'Begin; ¶
		 Set NewProgram "`Request "Program Name?" -d "{Program}" || Echo '""'`"; ¶
		 Exit If "{NewProgram}" == ""; ¶
		 Set Program "{NewProgram}"; ¶
		 Open "{Worksheet}"; ¶
		 Echo; Echo; ¶
		 BuildProgram "{Program}"; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build 'Build Same/º' ¶
		'Begin; ¶
		 Exit If "{Program}" == ""; ¶
		 Open "{Worksheet}"; ¶
		 Echo; Echo; ¶
		 BuildProgram "{Program}"; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build 'Full BuildÉ' ¶
		'Begin; ¶
		 Set NewProgram "`Request "Program Name?" -d "{Program}" || Echo '""'`"; ¶
		 Exit If "{NewProgram}" == ""; ¶
		 Set Program "{NewProgram}"; ¶
		 Open "{Worksheet}"; ¶
		 Echo; Echo; ¶
		 BuildProgram -e "{Program}"; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build 'Show Build CommandsÉ' ¶
		'Begin; ¶
		Set NewProgram "`Request "Program Name?" -d "{Program}" || Echo '""'`"; ¶
		 Exit If "{NewProgram}" == ""; ¶
		 Set Program "{NewProgram}"; ¶
		 Open "{Worksheet}"; ¶
		 Echo; Echo; ¶
		 BuildCommands "{Program}"; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build 'Show Full Build CommandsÉ' ¶
		'Begin; ¶
		 Set NewProgram "`Request "Program Name?" -d "{Program}" || Echo '""'`"; ¶
		 Exit If "{NewProgram}" == ""; ¶
		 Set Program "{NewProgram}"; ¶
		 Open "{Worksheet}"; ¶
		 Echo; Echo; ¶
		 BuildCommands -e "{Program}"; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build '(-' ''
	Alias MADebugOff		"AddMenu Build 'MABuild Debug' MADebugOn; Set MADebuggingFlag 0"
	Alias MADebugOn			"AddMenu Build 'MABuild Debug!' MADebugOff; Set MADebuggingFlag 1"
	Alias MASymOff			"AddMenu Build 'MABuild SADE Symbols' MASymOn; Set MASADEFlag 0"
	Alias MASymOn			"AddMenu Build 'MABuild SADE Symbols!' MASymOff; Set MASADEFlag 1"
	Alias MARunOff			"AddMenu Build 'MABuild Runs App' MARunOn; Set MARunFlag 0"
	Alias MARunOn			"AddMenu Build 'MABuild Runs App!' MARunOff; Set MARunFlag 1"
	Alias MAAutoBuildOff	"AddMenu Build 'MABuild AutoBuild MacApp' MAAutoBuildOn; Set MAAutoBuildFlag 0"
	Alias MAAutoBuildOn		"AddMenu Build 'MABuild AutoBuild MacApp!' MAAutoBuildOff; Set MAAutoBuildFlag 1"
	Alias EvalMAOpts ¶
		'If {MADebuggingFlag} == 1; Set CurMABuildOpts "-Debug"; Else; Set CurMABuildOpts "-NoDebug"; End; ¶
		 If {MASADEFlag} == 1; Set CurMABuildOpts "{CurMABuildOpts} -Sym"; End; ¶
		 If {MAAutoBuildFlag} == 1; Set CurMABuildOpts "{CurMABuildOpts} -AutoBuild"; End; ¶
		 If {MARunFlag} == 1; Set CurMABuildOpts "{CurMABuildOpts} -Run"; End'
	If {MADebuggingFlag} == 1
		AddMenu Build 'MABuild Debug!' MADebugOff
	Else
		AddMenu Build 'MABuild Debug' MADebugOn
	End
	If {MASADEFlag} == 1
		AddMenu Build 'MABuild SADE Symbols!' MASymOff
	Else
		AddMenu Build 'MABuild SADE Symbols' MASymOn
	End
	If {MARunFlag} == 1
		AddMenu Build 'MABuild Runs App!' MARunOff
	Else
		AddMenu Build 'MABuild Runs App' MARunOn
	End
	If {MAAutoBuildFlag} == 1
		AddMenu Build 'MABuild AutoBuild MacApp!' MAAutoBuildOff
	Else
		AddMenu Build 'MABuild AutoBuild MacApp' MAAutoBuildOn
	End
	AddMenu Build '(-' ''
	AddMenu Build 'MaBuildÉ' ¶
		'Begin; ¶
		 Set NewProgram "`Request "Program Name?" -d "{Program}" || Echo '""'`"; ¶
		 Exit If "{NewProgram}" == ""; ¶
		 EvalMAOpts; ¶
		 Set Program "{NewProgram}"; ¶
		 Open "{Worksheet}"; ¶
		 Echo; ¶
		 MABuild "{Program}" {CurMABuildOpts}; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build 'MABuild Same/Ã' ¶
		'Begin; ¶
		 Exit If "{Program}" == ""; ¶
		 EvalMAOpts; ¶
		 Open "{Worksheet}"; ¶
		 Echo; ¶
		 MABuild "{Program}" {CurMABuildOpts}; ¶
		 End >> "{Worksheet}" ³³ Dev:StdOut'
	AddMenu Build '(-' ''
	AddMenu Build 'Next Error/³' ¶
		'Begin; ¶
		 Find /¥[ ¶t]*File/ "{Worksheet}"; ¶
		 Find !0 "{Worksheet}"; ¶
		 Execute "{Worksheet}.¤"; ¶
		 End > Dev:Null ³ Dev:Null'
	AddMenu Build 'Previous Error/²' ¶
		'Begin; ¶
		 Find \¥[ ¶t]*File\ "{Worksheet}"; ¶
		 Find !0 "{Worksheet}"; ¶
		 Execute "{Worksheet}.¤"; ¶
		 End > Dev:Null ³ Dev:Null'
Set Exit 1
